package demo2;

public class Text {
    public static void main(String[] args) {
        Rect rect=new Rect();
        Cycle cycle=new Cycle();
        Triangle triangle=new Triangle();
        Shape[] shapes={rect,cycle,rect,cycle,triangle};
        for(Shape shape:shapes){
            shape.draw();
        }
    }
    public static void main2(String[] args) {
        Rect rect=new Rect();
        Cycle cycle=new Cycle();
        Triangle triangle=new Triangle();
        String[] strings={"rect","cycle","rect","cycle","triangle"};
        for(String string:strings){
            if(string.equals("rect")){
                rect.draw();
            }
            else if(string.equals("cycle")){
                cycle.draw();
            }
            else{
                triangle.draw();
            }
        }
    }
    public static void shapeMap(Shape shape){
        shape.draw();
    }
    public static void main1(String[] args) {
        Cycle cycle=new Cycle();
        Triangle triangle=new Triangle();
        Rect rect=new Rect();
        shapeMap(cycle);
        shapeMap(triangle);
        shapeMap(rect);
    }
}
